HOW TO ADD CSS

AKASH E



How to add CSS

CSS is incorporated into HTML pages to style the document based on the instructions in the stylesheet. There are three methods to include CSS in HTML documents.
  1. Inline CSS
  2. Internal CSS
  3. External CSS

Inline CSS

Inline CSS is used to apply styling to a specific line or element.

Example

<h1 style="color:red;">Hello</h1>

Internal CSS

Internal CSS is used to apply styles to a single document or page, impacting all the elements within it. It is placed within the <style> tag inside the <head> section of the HTML.

Example

<style>
h1{
   color:blue;
}
</style>

External CSS

External CSS is used to apply styles across multiple pages or the entire website. All the CSS code is written in a separate file with a .css extension, such as style.css.

Example

P{
 color:white;
}

You need to link the style.css file to your HTML pages like this:

<link rel="stylesheet " href="styles.css">

The <link> tag must be placed within the <head> section of the HTML.
Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send